import {CommonEntity} from "~/common/entity/common.entity";
import {Column, Entity, Index} from "typeorm";

@Index(["id"])
@Entity({name: "shop_goods"})
export class GoodsEntity extends CommonEntity {
  // 商品名称、商品描述、商品价格、商品库存、商品销量、商品分类、商品图片、商品状态、口令
  @Column({type: "varchar", length: 50, comment: "商品名称"})
  name: string;

  @Column({type: "text", comment: "商品描述"})
  description: string;

  @Column({type: "float", comment: "商品价格"})
  price: number;

  @Column({type: "int", comment: "商品库存", default: 0})
  stock: number;

  @Column({type: "int", comment: "商品销量", default: 0})
  sales: number;

  @Column({type: "varchar", length: 50, comment: "商品分类", default: ""})
  category: string;

  @Column({type: "text", comment: "商品图片"})
  image: string;

  @Column({type: "tinyint", comment: "商品状态", default: 1})
  status: number;

  @Column({type: "varchar", length: 200, comment: "口令"})
  password: string;
}
